package cn.itcast.map;

import cn.itcast.bean.CleanBean;
import org.apache.flink.api.common.functions.RichMapFunction;

import java.math.BigDecimal;

/**
 * 沪市数据转换-> CleanBean
 */
public class SseMap extends RichMapFunction<String, CleanBean> {
    @Override
    public CleanBean map(String value) throws Exception {
        //900|399998|中证煤炭|4063663|7197442|1078.71|1083.69|1300.43|866.95|881.72|881.72|T11|1713687241783
        String[] arr = value.split("\\|");
        return new CleanBean(
                arr[0],
                arr[1],
                arr[2],
                Long.valueOf(arr[3]),
                Long.valueOf(arr[4]),
                new BigDecimal(arr[5]),
                new BigDecimal(arr[6]),
                new BigDecimal(arr[7]),
                new BigDecimal(arr[8]),
                new BigDecimal(arr[9]),
                Long.valueOf(arr[12]),
               "sse"
        );
    }
}
